package cn.wolfcode.trip.app.web.controller;

import cn.wolfcode.trip.base.domain.Integral;
import cn.wolfcode.trip.base.domain.IntegralChange;
import cn.wolfcode.trip.base.query.IntegralQueryObject;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.IIntegralService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("integral")
public class IntegralController {
    @Autowired
    private IIntegralService integralService;
    @GetMapping("/{userId}")
    @ResponseBody
    public Object sign(@PathVariable Long userId) {
        Integral integral = integralService.getIntegralByuserId(userId);
        return integral;
    }
    @GetMapping
    @ResponseBody
    public Object listChange(IntegralQueryObject queryObject) {
        queryObject.setOrderBy("changeTime desc");
        PageInfo query = integralService.query(queryObject);
        return query;
    }
}
